#include "Producer.h"
#include "Consumer.h"
#include <iostream>
#include <memory>

using std::cout;
using std::endl;
using std::unique_ptr;

void test()
{
    TaskQueue taskQueue(10);

    unique_ptr<Thread> pro(new Producer(taskQueue));
    unique_ptr<Thread> con(new Consumer(taskQueue));

    //生产者与消费者运行
    pro->start();
    con->start();

    //主线程等待着生产者与消费者的退出
    pro->join();
    con->join();
}

int main(int argc, char **argv)
{
    test();
    return 0;
}

